#include <iostream>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>

using namespace std;
void fun(int signum)
{
    cout << "get signum" << signum << endl;
    sleep(1);
}

int main()
{
    signal(6,fun);
    int cnt = 5;
    while(1)
    {
        cout << "process running pid:" << getpid() << endl;
        sleep(1);
        if(cnt-- == 0)
            kill(getpid(), 6);
    }
    return 0;
}